<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html class="">
<head>
	
	<meta name="author" content="蓝凌科技">
	<meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="0" />

	<link rel="stylesheet" type="text/css" href="/Public/Api/css/sm.min.css">	
	<link rel="stylesheet" type="text/css" href="/Public/Api/css/sm-extend.min.css">	
	
	<title>帮工小哥</title>
	
	<script type="text/javascript">
	    var _root = '<?php echo ($_site_url); echo U(' / ');?>', _controller = '<?php echo ($_controller); ?>';
	</script>
	
	
	<link rel="stylesheet" type="text/css" href="/Public/Api/css/main.css">


</head>
<body>
	
	

<div class="page-group">
    <div class="page page-current">
        <div class="content native-scroll">
            <div class="register-info">
                <div class="content-padded">
                    <h1><?php echo ($banner['name']); ?></h1>
                    <h2>帮工小哥 <span><?php echo (GetDateMk($banner['name'])); ?></span></h2>
                    <p><?php echo (htmlspecialchars_decode($banner['content'])); ?></p>
                    
                    <?php if($banner["activity"] == '1'): ?><!-- 正在进行领取优惠券活动 -->
                    	
                    	<?php if($user_id >= '1' AND empty($coupon)): ?><div class="repair-num">
		                        <a href="#" onclick="coupon()">领取优惠券</a>
		                        <input type="hidden" name="random_num" id="random_num" value="<?php echo ($banner['random']); ?>"/>
		                        <input type="hidden" name="id" id="id" value="<?php echo ($banner['banner_id']); ?>"/>
		                    </div>
	                    <?php elseif(empty($user_id)): ?>
	                    	<div class="repair-num">
	                        <a href="<?php echo U('Public/login');?>">登录领取优惠券</a>
	                    </div><?php endif; ?>
                    <?php else: ?>
                    	<div class="repair-num">
	                        <a href="">赶快去注册吧</a>
	                    </div><?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>




	<!-- 底部
================================================== -->
<footer>
</footer>
<script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "", //当前网站地址
            "APP"    : "/api.php?s=", //当前项目地址
            "PUBLIC" : "/Public", //项目公共目录地址
            "DEEP"   : "<?php echo C('URL_PATHINFO_DEPR');?>", //PATHINFO分割符
            "MODEL"  : ["<?php echo C('URL_MODEL');?>", "<?php echo C('URL_CASE_INSENSITIVE');?>", "<?php echo C('URL_HTML_SUFFIX');?>"],
            "VAR"    : ["<?php echo C('VAR_MODULE');?>", "<?php echo C('VAR_CONTROLLER');?>", "<?php echo C('VAR_ACTION');?>"]
        }
    })();
    
</script>
<script src="/Public/Api/js/zepto.min.js" type="text/javascript">
</script>
<script type="text/javascript">
//坑死人的配置项
//若不加此配置，则所有页面均使用 js 和 css 缓存
$.config = {
   	router: false
}
</script>
<script src="/Public/Api/js/sm.min.js" type="text/javascript">
</script>
<script src="/Public/Api/js/sm-extend.min.js" type="text/javascript">
</script>
<script src="/Public/Api/js/think.js" type="text/javascript">
</script>


<script type="text/javascript">

function coupon(){
	
	var randomNum = $("#random_num").val();
	var rid = $("#id").val();
	var target = Think.U('Activity/receiveCoupon');
	
	$.post(target, {'random_num':randomNum, 'rid':rid}, function(dataObj){
		
		if (dataObj.status == '-201') {
			$.confirm('身份认证已失效，请重新登录', function () {
		        var loginURL = Think.U('Public/login');
		        window.location.href = loginURL;
		        return false;
		    });
		}else if(dataObj.status == '-1' || dataObj.status == '0'){
			var msg = dataObj.status == '-1' ? '参数错误' : '操作失败';
			$.confirm(msg, function () {
				window.location.reload();
		        return false;
		    });
		}else if(dataObj.status == '1'){
			$.alert('优惠券领取成功', function () {
				window.location.reload();
		    });
		}
	});
}

</script>

<!-- 用于加载js代码 -->

</body>
</html>